Skip to content

Conversation

Nielsbishere
Copy link
Contributor

This change introduces a new compiler option, -keep-all-resources, which ensures that even optimized-out resources are retained in DXIL reflection.

Motivation

By default, unused resources are removed during optimization, and applications may rely on their absence to infer optimization opportunities (e.g., skipping transitions). However, sometimes when reflection completeness is important (e.g., tools, debugging, visual scripting, or consistency with SPIR-V -Od) it is desirable to keep all declared resources visible in reflection, regardless of usage.

Behavior

When enabled, unused resources are not fully removed.
They will appear in reflection but will not generate createHandle instructions.

Notes

This is not enabled by default to avoid DXIL bloat and to prevent breaking apps that assume missing resources imply optimization.
Conflicts with #7729.
Step 2/2 to solve #5105.

…lection. This isn't default to avoid DXIL bloat and because apps might assume that if a resource is missing that it's optimized out and use this info to avoid transitions or other optimizations. When a resource is unused but still present, it won't emit a createHandle, but the reflection info will still be there
Copy link
Contributor

github-actions bot commented Sep 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant